
#ifndef __PARSER_TAB_H__
#define __PARSER_TAB_H__


enum StateID {
        STATE_NULL = 0,

        STATE_GROUND,
        STATE_ESCAPE,
        STATE_ESCAPE_INTERMEDIATE,
        STATE_CSI_ENTRY,
        STATE_CSI_PARAM,
        STATE_CSI_INTERMEDIATE,
        STATE_CSI_IGNORE,
        STATE_DCS_ENTRY,
        STATE_DCS_PARAM,
        STATE_DCS_INTERMEDIATE,
        STATE_DCS_PASSTHROUGH,
        STATE_DCS_IGNORE,
        STATE_OSC_STRING,
        STATE_SOS_PM_APC_STRING,

        STATE_COUNT
};

enum ActionID {
        ACTION_NULL = 0,

        ACTION_PRINT,
        ACTION_EXECUTE,
        ACTION_CLEAR,
        ACTION_COLLECT,
        ACTION_PARAM,
        ACTION_ESC_DISPATCH,
        ACTION_CSI_DISPATCH,
        ACTION_HOOK,
        ACTION_PUT,
        ACTION_UNHOOK,
        ACTION_OSC_START,
        ACTION_OSC_PUT,
        ACTION_OSC_END,

        ACTION_COUNT
};


#define EVENT_WCHAR	256	/* This event represents all wide characters */
#define EVENT_COUNT	257	/* 8bit chars [0..255] + wide char 256 */


struct Event {
        unsigned char   action    : 4;
        unsigned char   new_state : 4;
};


struct State {
        enum StateID    id;     	/* ID of this state */
        enum ActionID   entry;  	/* state entry action */
        enum ActionID   exit;   	/* state exit action */
        struct Event    event[EVENT_COUNT];
};
       

const struct State * parser_state_tab[STATE_COUNT];

#endif




